var Request = pi.base.extend({
  "$Init":function(_url){
    this.environment.setUrl(_url||"");
    return this;
  },
  "send":function(){
   this.environment.setTunnel(
     pi.util.Include(this.environment.getUrl(),this.abort.curry(this))
   );
   return this;
  },
  "abort":function(){
    var el = this.environment.getTunnel();
    if(el.parentNode){
      el.parentNode.removeChild(
        el
      );
    }
  },
  "environment":{
    "_url":"", "_tunnel":null, "_xhr":null
  },
  "event":{
    "success":function(_req){
      eval(_req.responseText);
    }
  }
});

Request.filter = function(_str){
  return _str.replace(/[^\w]+/gi,"_");
}

Request.inputController = function(_input,_event){
  var selStart = _input.selectionStart,
  selEnd = _input.selectionEnd,
  val = _input.value;
  _input.value = Request.filter(val);
  if(val!=_input.value){
    _input.setSelectionRange(selEnd+1,selEnd+1);
    _event.preventDefault();
  }
}
